package com.example.helloworld;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

public class Dialog extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_dialog);
	}

	public void showDialog(View view) {
		final TextView status =	(TextView)findViewById(R.id.textStatus);
		
		AlertDialog.Builder builder =	new AlertDialog.Builder(this);
		
		builder.setTitle("Information");
		builder.setMessage("Show Some Information");
		builder.setIcon(R.drawable.alert_dialog_icon);
		
		builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
			
			@Override
			public void onClick(DialogInterface dialog, int which) {
				final String message =	"OK button click." + Integer.toString(which);
				status.setText(message);
			}
			
		});

		builder.setNeutralButton("Cancle", new DialogInterface.OnClickListener() {
			
			@Override
			public void onClick(DialogInterface dialog, int which) {
				final String message =	"Cancle button click." + Integer.toString(which);
				status.setText(message);
			}
			
		});

		builder.setNegativeButton("No", new DialogInterface.OnClickListener() {
			
			@Override
			public void onClick(DialogInterface dialog, int which) {
				final String message =	"No button click." + Integer.toString(which);
				status.setText(message);
			}
			
		});
		
		AlertDialog dialog =	builder.create();
		dialog.show();
		
	}
}
